package com.eedi.framework.social.dal.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.eedi.framework.mybatis.core.mapper.BaseMapperX;
import com.eedi.framework.social.dal.dataobject.OrgSocialUserDO;
import com.eedi.framework.social.enmus.OrgSocialTypeEnum;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface OrgSocialUserMapper extends BaseMapperX<OrgSocialUserDO> {

    default OrgSocialUserDO selectByTypeAndCodeAnState(OrgSocialTypeEnum type, String code, String state) {
        return selectOne(new LambdaQueryWrapper<OrgSocialUserDO>()
                .eq(OrgSocialUserDO::getOrgSocialClientType, type)
                .eq(OrgSocialUserDO::getCode, code)
                .eq(OrgSocialUserDO::getState, state));
    }

    default OrgSocialUserDO selectByTypeAndOpenid(OrgSocialTypeEnum type, String openid) {
        return selectOne(new LambdaQueryWrapper<OrgSocialUserDO>()
                .eq(OrgSocialUserDO::getOrgSocialClientType, type)
                .eq(OrgSocialUserDO::getOpenid, openid));
    }

//    default PageResult<OrgSocialUserDO> selectPage(MemberSocialUserPageReq reqVO) {
//        return selectPage(reqVO, new LambdaQueryWrapperX<OrgSocialUserDO>()
//                .eqIfPresent(OrgSocialUserDO::getSysSocialUserType, reqVO.getSysSocialType())
//                .likeIfPresent(OrgSocialUserDO::getNickname, reqVO.getNickname())
//                .likeIfPresent(OrgSocialUserDO::getOpenid, reqVO.getOpenid())
//                .betweenIfPresent(OrgSocialUserDO::getCreateTime, reqVO.getCreateTime())
//                .orderByDesc(OrgSocialUserDO::getSysSocialUserId));
//    }

}
